package com.agileboot.attendance.domain.supplier.db;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 供应商信息表 Mapper 接口
 * </p>
 *
 * @author agileboot
 * @since 2023-03-14
 */
@Mapper
public interface AttSupplierMapper extends BaseMapper<AttSupplierEntity> {
    
    /**
     * 根据供应商ID查询供应商名称
     *
     * @param supplierId 供应商ID
     * @return 供应商名称
     */
    @Select("SELECT supplier_name FROM att_supplier WHERE supplier_id = #{supplierId}")
    String selectNameById(@Param("supplierId") Long supplierId);

    /**
     * 根据项目ID获取关联的供应商ID列表
     *
     * @param projectId 项目ID
     * @return 供应商ID列表
     */
    @Select("SELECT DISTINCT supplier_id FROM att_order WHERE project_id = #{projectId}")
    List<Long> getSupplierIdsByProjectId(@Param("projectId") Long projectId);
} 